package com.insurance.service.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.insurance.service.entity.BidSubjectEntity;
import com.insurance.common.utils.PageUtils;
import com.insurance.entity.OrderEntity;
import com.insurance.entity.ProposalCustomerEntity;
import com.insurance.entity.ProposalEntity;
import net.sf.json.JSONObject;

import java.util.List;
import java.util.Map;

/**
 * 投标
 *
 * @date 2020-10-11 14:02:06
 */
public interface BidSubjectService extends IService<BidSubjectEntity> {

    //region 分页查询投标信息

    /**
     * 分页查询投标信息
     *
     * @param params 查询条件
     * @return
     */
    PageUtils queryPage(Map<String, Object> params);
    //endregion


    //region 保存投标信息和投被保险人信息

    /**
     * 保存投标信息和投被保险人信息
     *
     * @param bidSubjectEntity 投标对象
     * @param proposalEntity 投保单对象
     * @param customerList 投被保险人对象
     * @return
     */
    boolean saveSubjectAndCustomers(BidSubjectEntity bidSubjectEntity, ProposalEntity proposalEntity,
                                    List<ProposalCustomerEntity> customerList) throws Exception;
    //endregion

    /**
     * 通过投保单主键查询
     *
     * @param proposalId 投保单主键
     * @return
     */
    BidSubjectEntity getByProposalId(String proposalId);

    /**
     * 平安预支付
     *
     * @param callUrl 点击确认回调地址
     * @param subjectId 标的主键
     * @param orderEntity 订单对象
     * @return
     */
    JSONObject prePayFinance(String callUrl, String subjectId, OrderEntity orderEntity);

    JSONObject acceptForFee(String subjectId);

}

